import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-08-21
 * Time: 15:02
 * To BE A Better Person-2020-3-2
 */
public class TcpDictServer extends TcpEchoServer{
    private Map<String,String> dict=new HashMap<>();
    public TcpDictServer(int port) throws IOException {
        super(port);
        dict.put("dog","小狗");
        dict.put("cat","小猫");
        dict.put("pool","泳池");
        dict.put("people","人");
    }

    @Override
    public String process(String request) {
        return dict.getOrDefault(request,"it didn't get");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer server=new TcpDictServer(8888);
        server.start();
    }
}
